package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.IMiguReadRetentConfigDao;
import org.jsbd.boss.domian.MiguReadRetentConfigBean;
import org.springframework.stereotype.Repository;

@Repository("miguReadRetentConfigDao")
public class MiguReadRetentConfigDaoImpl extends CrackBaseDao implements IMiguReadRetentConfigDao {

	@Override
	public void saveMiguReadRetentConfig(MiguReadRetentConfigBean miguReadRetentConfig) {
		super.insert("migu_read_retent_config.insert_migu_read_retent_config", miguReadRetentConfig);
	}

	@Override
	public void updateMiguReadRetentConfig(MiguReadRetentConfigBean miguReadRetentConfig) {
		super.insert("migu_read_retent_config.update_migu_read_retent_config", miguReadRetentConfig);
	}

	@Override
	public MiguReadRetentConfigBean getMiguReadRetentConfig(MiguReadRetentConfigBean miguReadRetentConfig) {
		return (MiguReadRetentConfigBean) super.queryForObject("migu_read_retent_config.select_migu_read_retent_config_one", miguReadRetentConfig);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<MiguReadRetentConfigBean> getMiguReadRetentConfigList(MiguReadRetentConfigBean miguReadRetentConfig) {
		return super.queryForList("migu_read_retent_config.select_migu_read_retent_config_list", miguReadRetentConfig);
	}

	@Override
	public Map<String, Object> getMiguReadRetentConfigListPage(DataGridModel page, MiguReadRetentConfigBean form) {
		form = (form == null ? new MiguReadRetentConfigBean() : form);
		form.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("total", super.queryForCount("migu_read_retent_config.select_migu_read_retent_config_page_count", form));
		results.put("rows", super.queryForList("migu_read_retent_config.select_migu_read_retent_config_list", form));
		return results;
	}

	@Override
	public Integer getMiguReadRetentConfigCount(MiguReadRetentConfigBean miguReadRetentConfig) {
		return super.queryForCount("migu_read_retent_config.select_migu_read_retent_config_page_count", miguReadRetentConfig);
	}

	public void deleteMiguReadRetentConfig(MiguReadRetentConfigBean miguReadRetentConfig){
		super.insert("migu_read_retent_config.del_migu_read_retent_config", miguReadRetentConfig);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<MiguReadRetentConfigBean> selectByMiguReadId(Integer id) {
		return super.queryForList("migu_read_retent_config.select_by_migu_read_id", id);
	}

	@Override
	public void insertMiguReadRetentConfig(List<MiguReadRetentConfigBean> targetList) {
		super.batchInsert("migu_read_retent_config.INSERT_RETENT", targetList);
	}

	@Override
	public void deleteByMiguReadId(Integer id) {
		super.delete("migu_read_retent_config.DELETE_BY_MIGU_MUSIC_ID", id);
	}

	@Override
	public void saveRetent(List<MiguReadRetentConfigBean> mvrcs) {
		super.batchInsert("migu_read_retent_config.INSERT_RETENT", mvrcs);
	}

	@Override
	public void deleteRetentBatch(MiguReadRetentConfigBean mvrcb) {
		super.delete("migu_read_retent_config.DELETE_RETENT_BATCH", mvrcb);
	}

}
